# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Contributor: Sergej Pupykin <arch+pub@sergej.pp.ru>
# Contributor: Ido Rosen <ido@kernel.org>
# Contributor: Ross Whitfield <whitfieldre@ornl.gov>
# Contributor: Mateusz Paluszkiewcz <aifam96 at gmail dot com>
# Contributor: Christopher Reimer <vdr4arch at creimer dot net>

pkgname=poco
pkgver=1.12.5p1
_pkgver=${pkgver/_/}
pkgrel=1
pkgdesc="C++ class libraries for network-centric, portable applications, complete edition with debug libraries"
arch=('loong64' 'x86_64')
url="http://www.pocoproject.org/"
license=('custom:boost')
depends=('mariadb-libs' 'openssl' 'unixodbc')
makedepends=('cmake' 'ninja')
source=("https://pocoproject.org/releases/poco-${_pkgver}/poco-${_pkgver}-all.tar.bz2"
		"0001-mariadb-replace-mysql.diff")
sha256sums=('9b4c55688aee9c9def95f659254d2f22606aba174941ed1b9cb7b7264a8f8f8e'
            '83628e398cd641d3b2a2645318c5c4a8130366673822936907446d792d3ef737')

prepare() {
  patch -p1 -d "poco-${_pkgver}-all" < 0001-mariadb-replace-mysql.diff
}

build() {
  cd "poco-${_pkgver}-all"

  cmake \
    -GNinja \
    -Bbuild \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=Release
  ninja -C build
}

package() {
  cd "poco-${_pkgver}-all"

  DESTDIR="${pkgdir}" ninja -C build install
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/poco/LICENSE"
}
